/**
 * Copyright (c) 2018 软唐 All rights reserved.
 * <p>
 * https://www.softtown.cn
 * <p>
 * 版权所有，侵权必究！
 */

package com.softtown.modules.sys.controller;

import com.softtown.common.annotation.LogOperation;
import com.softtown.common.utils.Result;
import com.softtown.modules.sys.dto.SysGuestMenuDTO;
import com.softtown.modules.sys.dto.SysMenuDTO;
import com.softtown.modules.sys.service.SysGuestMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 菜单管理
 *
 * @author Ding Ya Yong
 */
@RestController
@RequestMapping("/sys/guest")
@Api(tags = "游客菜单")
public class SysGuestMenuController {

    @Resource
    private SysGuestMenuService sysGuestMenuService;

    @PostMapping("getGuestMenu")
    @ApiOperation("获取游客菜单")
    @LogOperation("获取游客菜单")
    public Result getGuestMenu() {
        List<SysMenuDTO> sysMenuDTOList = sysGuestMenuService.getGusetAppMenus();
        return new Result<List<SysMenuDTO>>().ok(sysMenuDTOList);
    }

    @PostMapping("nav")
    @ApiOperation("游客菜单导航")
    @LogOperation("游客菜单导航")
    public Result<List<SysMenuDTO>> nav(@RequestBody SysGuestMenuDTO sysGuestMenuDTO) {
        List<SysMenuDTO> list = sysGuestMenuService.getGuestNav(sysGuestMenuDTO.getAppId());
        return new Result<List<SysMenuDTO>>().ok(list);
    }
}